package com.elder.web.controller.business;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson2.JSONObject;
import com.elder.business.domain.OrderStatistics;
import com.elder.business.service.IOrderStatisticsService;
import com.elder.common.annotation.Anonymous;
import com.elder.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.elder.common.annotation.Log;
import com.elder.common.core.controller.BaseController;
import com.elder.common.core.domain.AjaxResult;
import com.elder.common.enums.BusinessType;
import com.elder.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 * 
 * @author elder
 * @date 2024-03-17
 */
@RestController
public class OrderStatisticsController extends BaseController
{
    @Autowired
    private IOrderStatisticsService orderStatisticsService;

    /**
     * 查询【请填写功能名称】列表
     */
    @Anonymous
    @GetMapping("/system/statistics/list")
    public TableDataInfo list(Integer pageNum, Integer pageSize) {
        return orderStatisticsService.selectOrderStatisticsList(pageNum, pageSize);
    }


    /**
     * 获取【请填写功能名称】详细信息
     */
    @Anonymous
    @GetMapping(value = "/system/statistics/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(orderStatisticsService.selectOrderStatisticsById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @Anonymous
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping("/system/statistics")
    public AjaxResult add(@RequestBody OrderStatistics orderStatistics)
    {
        return toAjax(orderStatisticsService.insertOrderStatistics(orderStatistics));
    }

    /**
     * 修改【请填写功能名称】
     */
    @Anonymous
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping("/system/statistics")
    public AjaxResult edit(@RequestBody OrderStatistics orderStatistics)
    {
        return toAjax(orderStatisticsService.updateOrderStatistics(orderStatistics));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:statistics:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(orderStatisticsService.deleteOrderStatisticsByIds(ids));
    }


    @Anonymous
    @RequestMapping("order/statistics/info")
    public JSONObject orderStatisticsInfo(){
        return orderStatisticsService.getOrderStatisticsInfo();
    }
}
